package com.frejoys.service;

import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.service.IService;
import com.frejoys.common.dto.admin.UserLevelStoreMoneyListDto;
import com.frejoys.common.dto.common.PageDto;
import com.frejoys.common.vo.admin.UserLevelStoreMoneyListVo;
import com.frejoys.common.vo.app.AgentStoreListVo;
import com.frejoys.dao.entity.UserLevelStoreMoney;

import java.util.List;

public interface UserLevelStoreMoneyService extends IService<UserLevelStoreMoney> {

    default UserLevelStoreMoney getOnly(QueryWrapper<UserLevelStoreMoney> wrapper) {
        wrapper.last("limit 1");
        return this.getOne(wrapper);
    }

    default UserLevelStoreMoney getOnly(LambdaQueryWrapper<UserLevelStoreMoney> wrapper) {
        wrapper.last("limit 1");
        return this.getOne(wrapper);
    }

    /**
     *  没有用户店铺推广收益 就添加
     * @param userId  推广用户id
     * @param storeId 店铺id
     * @return
     */
    boolean addIfNot(Long userId, Integer storeId);

    IPage<UserLevelStoreMoneyListVo> userLevelStoreMoneyListInfo(UserLevelStoreMoneyListDto dto);

    //查询店铺给我带来的收益
    List<AgentStoreListVo> listInfo(PageDto dto, Long userId);
}
